package com.mingmen.supplier.activity;


import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.lzy.imagepicker.ImagePicker;
import com.mingmen.supplier.R;
import com.mingmen.supplier.adapter.GongYingLabelAdapter;
import com.mingmen.supplier.adapter.StringTagAdapter;
import com.mingmen.supplier.flex.interfaces.OnFlexboxSubscribeListener;
import com.mingmen.supplier.flex.widget.TagFlowLayout;
import com.mingmen.supplier.http.callback.StringCallback;
import com.mingmen.supplier.httpconfig.HttpResponse;
import com.mingmen.supplier.immersionbar.ImmersionBar;
import com.mingmen.supplier.label.recycler.OnItemClickListener;
import com.mingmen.supplier.model.GongYingLabelModel;
import com.mingmen.supplier.util.GsonUtil;
import com.mingmen.supplier.util.MyStringUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import okhttp3.Call;
import okhttp3.Response;

public class GongYingNewLabelActivity extends AppCompatActivity {

    //返回按钮
    @BindView(R.id.text_return)
    TextView textReturn;
    //    中间按钮
    @BindView(R.id.text_center)
    TextView textCenter;
    private ImagePicker imagePicker;

    String text_pinlei;
    List<String> receiveList = new ArrayList<>();
    @BindView(R.id.linear_return)
    LinearLayout linear_return;
    int flag = 0;
    private StringTagAdapter adapter;

    private List<String> sourceData;
    private List<String> selectItems;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_gongyingnewlabel);
        ButterKnife.bind(this);
        ImmersionBar.with(this)
                .statusBarDarkFont(true, 0.2f)
                .init();

//        s设置状态栏
        textCenter.setText("供应商经营品类");
        text_pinlei = getIntent().getStringExtra("text_pinlei");
        initData();
        initViews();
    }

    private void initData() {
        sourceData = new ArrayList<>();
        sourceData.add("程序员");
        sourceData.add("设计师");
        sourceData.add("产品经理");
        sourceData.add("运营");
        sourceData.add("商务");
        sourceData.add("人事经理");
        sourceData.add("项目经理");
        sourceData.add("客户代表");
        sourceData.add("技术主管");
        sourceData.add("测试工程师");
        sourceData.add("前端工程师");
        sourceData.add("Java工程师");
        sourceData.add("Android工程师");
        sourceData.add("iOS工程师");

        selectItems = new ArrayList<>();
        selectItems.add("客户代表");
        selectItems.add("Java工程师");
    }

    private void initViews() {
        TagFlowLayout flowLayout = (TagFlowLayout) findViewById(R.id.flow_layout);

        adapter = new StringTagAdapter(this, sourceData, selectItems);
        adapter.setOnSubscribeListener(new OnFlexboxSubscribeListener<String>() {
            @Override
            public void onSubscribe(List<String> selectedItem) {

                Log.d("selectedItem", selectedItem.toString());

            }
        });

        flowLayout.setAdapter(adapter);

        Log.d("getSelectedList", adapter.getSelectedList().toString());

    }

    @OnClick({R.id.text_return,  R.id.linear_return})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.text_return:
            case R.id.linear_return:
                finish();
                break;

        }
    }


}




